<template>
  <div
    class="VAffix scrollable-container"
    id="components-affix-demo-target"
    ref="container"
  >
    <h1>This is an VAffix page</h1>
    <div class="background">
      <a-affix :target="() => this.$refs.container">
        <a-button type="primary">
          Fixed at the top of container
        </a-button>
      </a-affix>
    </div>
  </div>
</template>
<style>
#components-affix-demo-target.scrollable-container {
  height: 300px;
  overflow-y: scroll;
}
#components-affix-demo-target .background {
  padding-top: 60px;
  height: 500px;
  background-image: url("https://zos.alipayobjects.com/rmsportal/RmjwQiJorKyobvI.jpg");
}
</style>